package com.atguigu06.collections.exer;

import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.ForkJoinPool;

/**
 * ClassName: PockerTest
 * Package: com.atguigu06.collections.exer
 * Description:
 *
 * @Author BuTang
 * @Create 2023/6/7 17:35
 * @Version 1.0
 */
public class PockerTest {


    public static void main(String[] args) {
        String[] num = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
        String[] color = {"方片♦", "梅花♣", "红桃♥", "黑桃♠"};

        //在牌库内添加牌
        ArrayList poker = new ArrayList();
        for (int i = 0; i < color.length; i++) {
            for (int j = 0; j < num.length; j++) {
                poker.add(num[j] + color[i]);
            }
        }

        Collections.shuffle(poker);
        System.out.println(poker);

        //创建玩家和底牌
        ArrayList Tom = new ArrayList();
        ArrayList Jerry = new ArrayList();
        ArrayList me = new ArrayList();
        ArrayList LastCards = new ArrayList();

        for (int i = 0; i < poker.size(); i++) {
            if ( poker.size() - i < 4 ){
                LastCards.add(poker.get(i));
            }else if (i % 3 == 0)Tom.add(poker.get(i));
            else if (i % 3 == 1)Jerry.add(poker.get(i));
            else if (i % 3 == 2)me.add(poker.get(i));
        }

        System.out.println("Tom的牌"+Tom);
        System.out.println("TJerrt的牌"+Jerry);
        System.out.println("我的牌"+me);
        System.out.println("底牌"+LastCards);
    }


}
